export default {
	methods: {
		// 根据车间过滤工序列表及赋值默认
		getProcessListByWorkshop() {
			const list = this.$store.state.user.userProcess.processList;
			this.processList = this.searchParams.workshopId ? list.filter(x => x.workshopId === this.searchParams.workshopId) : [];
			if (!this.processList.find(x => x.code === this.searchParams.processCode)) {
				// 个人默认工序权限不在列表项内时，默认第一个
				if (!this.processList.find(x => x.code === this.$store.state.user.userProcess.defaultProcessCode)) {
					this.$set(this.searchParams, 'processCode', this.processList && this.processList.length ? this.processList[0].code : '');
				} else {
					this.$set(this.searchParams, 'processCode', this.$store.state.user.userProcess.defaultProcessCode);
				}
			}
		}
	}
};
